//
//  LMEGoodsModel.h
//  WelfareManager
//
//  Created by longmin on 17/2/27.
//  Copyright © 2017年 timtian. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum {  //商品类型
    LMEGoodsTypeReal = 1,   //实物
    LMEGoodsTypeVirtual     //虚拟
}LMEGoodsType;

typedef enum {
    LMEGoodsStateNormal,    //可选
    LMEGoodsStateSelected,  //已选
}LMEGoodsState;

typedef enum {
    LMEGoodsSourceTypePlatform = 1, //平台商品
    LMEGoodsSourceTypeSelf  //自有商品
}LMEGoodsSourceType;


@class LMESchemePageModel;
@interface LMEGoodsModel : NSObject

//source 平台
@property(nonatomic, assign) LMEGoodsSourceType source;
//"product_id":"商品id",
@property(nonatomic, strong) NSString *product_id;
//"type":"商品类型，1：实物，2：虚拟",
@property(nonatomic, assign) LMEGoodsType type;
//"category_id":"商品类目",
@property(nonatomic, strong) NSString *category_id;
//"category_name":"类目名称",
@property(nonatomic, strong) NSString *category_name;
//"pic":"商品主图",
@property(nonatomic, strong) NSString *pic;
//"title":"商品名称",
@property(nonatomic, strong) NSString *title;
//"pro_code":"商品货号",
@property(nonatomic, strong) NSString *pro_code;
//"price":"销售价格",
@property(nonatomic, strong) NSString *price;
//"market_price":"市场价",
@property(nonatomic, strong) NSString *market_price;
//"stock":"库存",
@property(nonatomic, strong) NSString *stock;
//"sales":"销量",
@property(nonatomic, strong) NSString *sales;
//"create_time":"添加时间"
@property(nonatomic, strong) NSString *create_time;
//"status":"状态",
@property(nonatomic, strong) NSString *status;
//"brand_name":"商品品牌",
@property(nonatomic, strong) NSString *brand_name;
//"detail":"商品详情",
@property(nonatomic, strong) NSString *detail;
//"configure": "主体产品品牌 卡饰社类别手机支架颜色红色材质ABS适用车型 通用 产地中国大陆"
@property(nonatomic, strong) NSString *configure;
//"in_scheme":"是否选入方案，1：是，0：否（非必存在）",
@property(nonatomic, assign) BOOL in_scheme;
//起订量   --客户端专用
@property(nonatomic, strong) NSString *min_order;
//供应价   --客户端专用
@property(nonatomic, strong) NSString *supply_price;
//销售价   --客户端专用
@property(nonatomic, strong) NSString *sale_price;
//选择状态 客户端计算用字段
@property(nonatomic, assign) LMEGoodsState state;


/**
 通过page对象生成goods对象
 */
+ (instancetype)goodsWithPage:(LMESchemePageModel *)pageModel;


/**
 通过pagelist生成goodslist
 */
+ (NSMutableArray *)goodsListWithPageList:(NSArray <LMESchemePageModel *> *)pageList;


/**
 比较两个商品数组, 返回修改过in_scheme的商品数组
 @param goodsList 没有处理够的商品数组
 @param selectList 已经选中的商品数组
 @return 修改过的商品数组
 */
+ (NSMutableArray *)compareGoodsList:(NSArray *)goodsList SelectList:(NSArray *)selectList;

/**
 刷新商品页面后,保留选中的数组

 @param newlist 刷新后的商品数组
 @param selectList 选中的商品数组
 @return 修改过选中状态的商品数组
 */
+ (NSMutableArray *)refreshGoodsList:(NSArray *)newlist selectList:(NSArray *)selectList;

/**
 添加商品

 @param goodsList 原有的商品数组
 @param goodsModel 被添加的商品
 */
+ (void)addGoodsWithMainList:(NSMutableArray *)goodsList newGoods:(LMEGoodsModel *)goodsModel;

/**
 移除商品

 @param goodsList 原有的商品数组
 @param goodsModel 要删除的商品
 */
+ (void)removeGoodsWithMainList:(NSMutableArray *)goodsList removedGoods:(LMEGoodsModel *)goodsModel;
@end
